home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_xemacs.idb / usr / freeware / lib / xemacs-20.4 / info / lispref.info-29.z / lispref.info-29
Encoding:
GNU Info File  |  1998-05-21  |  50.7 KB  |  1,182 lines

  1. This is Info file ../../info/lispref.info, produced by Makeinfo version
  2. 1.68 from the input file lispref.texi.
  3.  
  4.    Edition History:
  5.  
  6.    GNU Emacs Lisp Reference Manual Second Edition (v2.01), May 1993 GNU
  7. Emacs Lisp Reference Manual Further Revised (v2.02), August 1993 Lucid
  8. Emacs Lisp Reference Manual (for 19.10) First Edition, March 1994
  9. XEmacs Lisp Programmer's Manual (for 19.12) Second Edition, April 1995
  10. GNU Emacs Lisp Reference Manual v2.4, June 1995 XEmacs Lisp
  11. Programmer's Manual (for 19.13) Third Edition, July 1995 XEmacs Lisp
  12. Reference Manual (for 19.14 and 20.0) v3.1, March 1996 XEmacs Lisp
  13. Reference Manual (for 19.15 and 20.1, 20.2) v3.2, April, May 1997
  14.  
  15.    Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995 Free Software
  16. Foundation, Inc.  Copyright (C) 1994, 1995 Sun Microsystems, Inc.
  17. Copyright (C) 1995, 1996 Ben Wing.
  18.  
  19.    Permission is granted to make and distribute verbatim copies of this
  20. manual provided the copyright notice and this permission notice are
  21. preserved on all copies.
  22.  
  23.    Permission is granted to copy and distribute modified versions of
  24. this manual under the conditions for verbatim copying, provided that the
  25. entire resulting derived work is distributed under the terms of a
  26. permission notice identical to this one.
  27.  
  28.    Permission is granted to copy and distribute translations of this
  29. manual into another language, under the above conditions for modified
  30. versions, except that this permission notice may be stated in a
  31. translation approved by the Foundation.
  32.  
  33.    Permission is granted to copy and distribute modified versions of
  34. this manual under the conditions for verbatim copying, provided also
  35. that the section entitled "GNU General Public License" is included
  36. exactly as in the original, and provided that the entire resulting
  37. derived work is distributed under the terms of a permission notice
  38. identical to this one.
  39.  
  40.    Permission is granted to copy and distribute translations of this
  41. manual into another language, under the above conditions for modified
  42. versions, except that the section entitled "GNU General Public License"
  43. may be included in a translation approved by the Free Software
  44. Foundation instead of in the original English.
  45.  
  46. 
  47. File: lispref.info,  Node: Sorting,  Next: Columns,  Prev: Auto Filling,  Up: Text
  48.  
  49. Sorting Text
  50. ============
  51.  
  52.    The sorting functions described in this section all rearrange text in
  53. a buffer.  This is in contrast to the function `sort', which rearranges
  54. the order of the elements of a list (*note Rearrangement::.).  The
  55. values returned by these functions are not meaningful.
  56.  
  57.  - Function: sort-subr REVERSE NEXTRECFUN ENDRECFUN &optional
  58.           STARTKEYFUN ENDKEYFUN
  59.      This function is the general text-sorting routine that divides a
  60.      buffer into records and sorts them.  Most of the commands in this
  61.      section use this function.
  62.  
  63.      To understand how `sort-subr' works, consider the whole accessible
  64.      portion of the buffer as being divided into disjoint pieces called
  65.      "sort records".  The records may or may not be contiguous; they may
  66.      not overlap.  A portion of each sort record (perhaps all of it) is
  67.      designated as the sort key.  Sorting rearranges the records in
  68.      order by their sort keys.
  69.  
  70.      Usually, the records are rearranged in order of ascending sort key.
  71.      If the first argument to the `sort-subr' function, REVERSE, is
  72.      non-`nil', the sort records are rearranged in order of descending
  73.      sort key.
  74.  
  75.      The next four arguments to `sort-subr' are functions that are
  76.      called to move point across a sort record.  They are called many
  77.      times from within `sort-subr'.
  78.  
  79.        1. NEXTRECFUN is called with point at the end of a record.  This
  80.           function moves point to the start of the next record.  The
  81.           first record is assumed to start at the position of point
  82.           when `sort-subr' is called.  Therefore, you should usually
  83.           move point to the beginning of the buffer before calling
  84.           `sort-subr'.
  85.  
  86.           This function can indicate there are no more sort records by
  87.           leaving point at the end of the buffer.
  88.  
  89.        2. ENDRECFUN is called with point within a record.  It moves
  90.           point to the end of the record.
  91.  
  92.        3. STARTKEYFUN is called to move point from the start of a
  93.           record to the start of the sort key.  This argument is
  94.           optional; if it is omitted, the whole record is the sort key.
  95.           If supplied, the function should either return a non-`nil'
  96.           value to be used as the sort key, or return `nil' to indicate
  97.           that the sort key is in the buffer starting at point.  In the
  98.           latter case, ENDKEYFUN is called to find the end of the sort
  99.           key.
  100.  
  101.        4. ENDKEYFUN is called to move point from the start of the sort
  102.           key to the end of the sort key.  This argument is optional.
  103.           If STARTKEYFUN returns `nil' and this argument is omitted (or
  104.           `nil'), then the sort key extends to the end of the record.
  105.           There is no need for ENDKEYFUN if STARTKEYFUN returns a
  106.           non-`nil' value.
  107.  
  108.      As an example of `sort-subr', here is the complete function
  109.      definition for `sort-lines':
  110.  
  111.           ;; Note that the first two lines of doc string
  112.           ;; are effectively one line when viewed by a user.
  113.           (defun sort-lines (reverse beg end)
  114.             "Sort lines in region alphabetically.
  115.           Called from a program, there are three arguments:
  116.           REVERSE (non-nil means reverse order),
  117.           and BEG and END (the region to sort)."
  118.             (interactive "P\nr")
  119.             (save-restriction
  120.               (narrow-to-region beg end)
  121.               (goto-char (point-min))
  122.               (sort-subr reverse
  123.                          'forward-line
  124.                          'end-of-line)))
  125.  
  126.      Here `forward-line' moves point to the start of the next record,
  127.      and `end-of-line' moves point to the end of record.  We do not pass
  128.      the arguments STARTKEYFUN and ENDKEYFUN, because the entire record
  129.      is used as the sort key.
  130.  
  131.      The `sort-paragraphs' function is very much the same, except that
  132.      its `sort-subr' call looks like this:
  133.  
  134.           (sort-subr reverse
  135.                      (function
  136.                       (lambda ()
  137.                         (skip-chars-forward "\n \t\f")))
  138.                      'forward-paragraph)
  139.  
  140.  - Command: sort-regexp-fields REVERSE RECORD-REGEXP KEY-REGEXP START
  141.           END
  142.      This command sorts the region between START and END alphabetically
  143.      as specified by RECORD-REGEXP and KEY-REGEXP.  If REVERSE is a
  144.      negative integer, then sorting is in reverse order.
  145.  
  146.      Alphabetical sorting means that two sort keys are compared by
  147.      comparing the first characters of each, the second characters of
  148.      each, and so on.  If a mismatch is found, it means that the sort
  149.      keys are unequal; the sort key whose character is less at the
  150.      point of first mismatch is the lesser sort key.  The individual
  151.      characters are compared according to their numerical values.
  152.      Since Emacs uses the ASCII character set, the ordering in that set
  153.      determines alphabetical order.
  154.  
  155.      The value of the RECORD-REGEXP argument specifies how to divide
  156.      the buffer into sort records.  At the end of each record, a search
  157.      is done for this regular expression, and the text that matches it
  158.      is the next record.  For example, the regular expression `^.+$',
  159.      which matches lines with at least one character besides a newline,
  160.      would make each such line into a sort record.  *Note Regular
  161.      Expressions::, for a description of the syntax and meaning of
  162.      regular expressions.
  163.  
  164.      The value of the KEY-REGEXP argument specifies what part of each
  165.      record is the sort key.  The KEY-REGEXP could match the whole
  166.      record, or only a part.  In the latter case, the rest of the
  167.      record has no effect on the sorted order of records, but it is
  168.      carried along when the record moves to its new position.
  169.  
  170.      The KEY-REGEXP argument can refer to the text matched by a
  171.      subexpression of RECORD-REGEXP, or it can be a regular expression
  172.      on its own.
  173.  
  174.      If KEY-REGEXP is:
  175.  
  176.     `\DIGIT'
  177.           then the text matched by the DIGITth `\(...\)' parenthesis
  178.           grouping in RECORD-REGEXP is the sort key.
  179.  
  180.     `\&'
  181.           then the whole record is the sort key.
  182.  
  183.     a regular expression
  184.           then `sort-regexp-fields' searches for a match for the regular
  185.           expression within the record.  If such a match is found, it
  186.           is the sort key.  If there is no match for KEY-REGEXP within
  187.           a record then that record is ignored, which means its
  188.           position in the buffer is not changed.  (The other records
  189.           may move around it.)
  190.  
  191.      For example, if you plan to sort all the lines in the region by the
  192.      first word on each line starting with the letter `f', you should
  193.      set RECORD-REGEXP to `^.*$' and set KEY-REGEXP to `\<f\w*\>'.  The
  194.      resulting expression looks like this:
  195.  
  196.           (sort-regexp-fields nil "^.*$" "\\<f\\w*\\>"
  197.                               (region-beginning)
  198.                               (region-end))
  199.  
  200.      If you call `sort-regexp-fields' interactively, it prompts for
  201.      RECORD-REGEXP and KEY-REGEXP in the minibuffer.
  202.  
  203.  - Command: sort-lines REVERSE START END
  204.      This command alphabetically sorts lines in the region between
  205.      START and END.  If REVERSE is non-`nil', the sort is in reverse
  206.      order.
  207.  
  208.  - Command: sort-paragraphs REVERSE START END
  209.      This command alphabetically sorts paragraphs in the region between
  210.      START and END.  If REVERSE is non-`nil', the sort is in reverse
  211.      order.
  212.  
  213.  - Command: sort-pages REVERSE START END
  214.      This command alphabetically sorts pages in the region between
  215.      START and END.  If REVERSE is non-`nil', the sort is in reverse
  216.      order.
  217.  
  218.  - Command: sort-fields FIELD START END
  219.      This command sorts lines in the region between START and END,
  220.      comparing them alphabetically by the FIELDth field of each line.
  221.      Fields are separated by whitespace and numbered starting from 1.
  222.      If FIELD is negative, sorting is by the -FIELDth field from the
  223.      end of the line.  This command is useful for sorting tables.
  224.  
  225.  - Command: sort-numeric-fields FIELD START END
  226.      This command sorts lines in the region between START and END,
  227.      comparing them numerically by the FIELDth field of each line.  The
  228.      specified field must contain a number in each line of the region.
  229.      Fields are separated by whitespace and numbered starting from 1.
  230.      If FIELD is negative, sorting is by the -FIELDth field from the
  231.      end of the line.  This command is useful for sorting tables.
  232.  
  233.  - Command: sort-columns REVERSE &optional BEG END
  234.      This command sorts the lines in the region between BEG and END,
  235.      comparing them alphabetically by a certain range of columns.  The
  236.      column positions of BEG and END bound the range of columns to sort
  237.      on.
  238.  
  239.      If REVERSE is non-`nil', the sort is in reverse order.
  240.  
  241.      One unusual thing about this command is that the entire line
  242.      containing position BEG, and the entire line containing position
  243.      END, are included in the region sorted.
  244.  
  245.      Note that `sort-columns' uses the `sort' utility program, and so
  246.      cannot work properly on text containing tab characters.  Use `M-x
  247.      `untabify'' to convert tabs to spaces before sorting.
  248.  
  249. 
  250. File: lispref.info,  Node: Columns,  Next: Indentation,  Prev: Sorting,  Up: Text
  251.  
  252. Counting Columns
  253. ================
  254.  
  255.    The column functions convert between a character position (counting
  256. characters from the beginning of the buffer) and a column position
  257. (counting screen characters from the beginning of a line).
  258.  
  259.    A character counts according to the number of columns it occupies on
  260. the screen.  This means control characters count as occupying 2 or 4
  261. columns, depending upon the value of `ctl-arrow', and tabs count as
  262. occupying a number of columns that depends on the value of `tab-width'
  263. and on the column where the tab begins.  *Note Usual Display::.
  264.  
  265.    Column number computations ignore the width of the window and the
  266. amount of horizontal scrolling.  Consequently, a column value can be
  267. arbitrarily high.  The first (or leftmost) column is numbered 0.
  268.  
  269.  - Function: current-column
  270.      This function returns the horizontal position of point, measured in
  271.      columns, counting from 0 at the left margin.  The column position
  272.      is the sum of the widths of all the displayed representations of
  273.      the characters between the start of the current line and point.
  274.  
  275.      For an example of using `current-column', see the description of
  276.      `count-lines' in *Note Text Lines::.
  277.  
  278.  - Function: move-to-column COLUMN &optional FORCE
  279.      This function moves point to COLUMN in the current line.  The
  280.      calculation of COLUMN takes into account the widths of the
  281.      displayed representations of the characters between the start of
  282.      the line and point.
  283.  
  284.      If column COLUMN is beyond the end of the line, point moves to the
  285.      end of the line.  If COLUMN is negative, point moves to the
  286.      beginning of the line.
  287.  
  288.      If it is impossible to move to column COLUMN because that is in
  289.      the middle of a multicolumn character such as a tab, point moves
  290.      to the end of that character.  However, if FORCE is non-`nil', and
  291.      COLUMN is in the middle of a tab, then `move-to-column' converts
  292.      the tab into spaces so that it can move precisely to column
  293.      COLUMN.  Other multicolumn characters can cause anomalies despite
  294.      FORCE, since there is no way to split them.
  295.  
  296.      The argument FORCE also has an effect if the line isn't long
  297.      enough to reach column COLUMN; in that case, it says to add
  298.      whitespace at the end of the line to reach that column.
  299.  
  300.      If COLUMN is not an integer, an error is signaled.
  301.  
  302.      The return value is the column number actually moved to.
  303.  
  304. 
  305. File: lispref.info,  Node: Indentation,  Next: Case Changes,  Prev: Columns,  Up: Text
  306.  
  307. Indentation
  308. ===========
  309.  
  310.    The indentation functions are used to examine, move to, and change
  311. whitespace that is at the beginning of a line.  Some of the functions
  312. can also change whitespace elsewhere on a line.  Columns and indentation
  313. count from zero at the left margin.
  314.  
  315. * Menu:
  316.  
  317. * Primitive Indent::      Functions used to count and insert indentation.
  318. * Mode-Specific Indent::  Customize indentation for different modes.
  319. * Region Indent::         Indent all the lines in a region.
  320. * Relative Indent::       Indent the current line based on previous lines.
  321. * Indent Tabs::           Adjustable, typewriter-like tab stops.
  322. * Motion by Indent::      Move to first non-blank character.
  323.  
  324. 
  325. File: lispref.info,  Node: Primitive Indent,  Next: Mode-Specific Indent,  Up: Indentation
  326.  
  327. Indentation Primitives
  328. ----------------------
  329.  
  330.    This section describes the primitive functions used to count and
  331. insert indentation.  The functions in the following sections use these
  332. primitives.
  333.  
  334.  - Function: current-indentation
  335.      This function returns the indentation of the current line, which is
  336.      the horizontal position of the first nonblank character.  If the
  337.      contents are entirely blank, then this is the horizontal position
  338.      of the end of the line.
  339.  
  340.  - Command: indent-to COLUMN &optional MINIMUM
  341.      This function indents from point with tabs and spaces until COLUMN
  342.      is reached.  If MINIMUM is specified and non-`nil', then at least
  343.      that many spaces are inserted even if this requires going beyond
  344.      COLUMN.  Otherwise the function does nothing if point is already
  345.      beyond COLUMN.  The value is the column at which the inserted
  346.      indentation ends.
  347.  
  348.  - User Option: indent-tabs-mode
  349.      If this variable is non-`nil', indentation functions can insert
  350.      tabs as well as spaces.  Otherwise, they insert only spaces.
  351.      Setting this variable automatically makes it local to the current
  352.      buffer.
  353.  
  354. 
  355. File: lispref.info,  Node: Mode-Specific Indent,  Next: Region Indent,  Prev: Primitive Indent,  Up: Indentation
  356.  
  357. Indentation Controlled by Major Mode
  358. ------------------------------------
  359.  
  360.    An important function of each major mode is to customize the <TAB>
  361. key to indent properly for the language being edited.  This section
  362. describes the mechanism of the <TAB> key and how to control it.  The
  363. functions in this section return unpredictable values.
  364.  
  365.  - Variable: indent-line-function
  366.      This variable's value is the function to be used by <TAB> (and
  367.      various commands) to indent the current line.  The command
  368.      `indent-according-to-mode' does no more than call this function.
  369.  
  370.      In Lisp mode, the value is the symbol `lisp-indent-line'; in C
  371.      mode, `c-indent-line'; in Fortran mode, `fortran-indent-line'.  In
  372.      Fundamental mode, Text mode, and many other modes with no standard
  373.      for indentation, the value is `indent-to-left-margin' (which is the
  374.      default value).
  375.  
  376.  - Command: indent-according-to-mode
  377.      This command calls the function in `indent-line-function' to
  378.      indent the current line in a way appropriate for the current major
  379.      mode.
  380.  
  381.  - Command: indent-for-tab-command
  382.      This command calls the function in `indent-line-function' to indent
  383.      the current line; except that if that function is
  384.      `indent-to-left-margin', it calls `insert-tab' instead.  (That is
  385.      a trivial command that inserts a tab character.)
  386.  
  387.  - Command: newline-and-indent
  388.      This function inserts a newline, then indents the new line (the one
  389.      following the newline just inserted) according to the major mode.
  390.  
  391.      It does indentation by calling the current `indent-line-function'.
  392.      In programming language modes, this is the same thing <TAB> does,
  393.      but in some text modes, where <TAB> inserts a tab,
  394.      `newline-and-indent' indents to the column specified by
  395.      `left-margin'.
  396.  
  397.  - Command: reindent-then-newline-and-indent
  398.      This command reindents the current line, inserts a newline at
  399.      point, and then reindents the new line (the one following the
  400.      newline just inserted).
  401.  
  402.      This command does indentation on both lines according to the
  403.      current major mode, by calling the current value of
  404.      `indent-line-function'.  In programming language modes, this is
  405.      the same thing <TAB> does, but in some text modes, where <TAB>
  406.      inserts a tab, `reindent-then-newline-and-indent' indents to the
  407.      column specified by `left-margin'.
  408.  
  409. 
  410. File: lispref.info,  Node: Region Indent,  Next: Relative Indent,  Prev: Mode-Specific Indent,  Up: Indentation
  411.  
  412. Indenting an Entire Region
  413. --------------------------
  414.  
  415.    This section describes commands that indent all the lines in the
  416. region.  They return unpredictable values.
  417.  
  418.  - Command: indent-region START END TO-COLUMN
  419.      This command indents each nonblank line starting between START
  420.      (inclusive) and END (exclusive).  If TO-COLUMN is `nil',
  421.      `indent-region' indents each nonblank line by calling the current
  422.      mode's indentation function, the value of `indent-line-function'.
  423.  
  424.      If TO-COLUMN is non-`nil', it should be an integer specifying the
  425.      number of columns of indentation; then this function gives each
  426.      line exactly that much indentation, by either adding or deleting
  427.      whitespace.
  428.  
  429.      If there is a fill prefix, `indent-region' indents each line by
  430.      making it start with the fill prefix.
  431.  
  432.  - Variable: indent-region-function
  433.      The value of this variable is a function that can be used by
  434.      `indent-region' as a short cut.  You should design the function so
  435.      that it will produce the same results as indenting the lines of the
  436.      region one by one, but presumably faster.
  437.  
  438.      If the value is `nil', there is no short cut, and `indent-region'
  439.      actually works line by line.
  440.  
  441.      A short-cut function is useful in modes such as C mode and Lisp
  442.      mode, where the `indent-line-function' must scan from the
  443.      beginning of the function definition: applying it to each line
  444.      would be quadratic in time.  The short cut can update the scan
  445.      information as it moves through the lines indenting them; this
  446.      takes linear time.  In a mode where indenting a line individually
  447.      is fast, there is no need for a short cut.
  448.  
  449.      `indent-region' with a non-`nil' argument TO-COLUMN has a
  450.      different meaning and does not use this variable.
  451.  
  452.  - Command: indent-rigidly START END COUNT
  453.      This command indents all lines starting between START (inclusive)
  454.      and END (exclusive) sideways by COUNT columns.  This "preserves
  455.      the shape" of the affected region, moving it as a rigid unit.
  456.      Consequently, this command is useful not only for indenting
  457.      regions of unindented text, but also for indenting regions of
  458.      formatted code.
  459.  
  460.      For example, if COUNT is 3, this command adds 3 columns of
  461.      indentation to each of the lines beginning in the region specified.
  462.  
  463.      In Mail mode, `C-c C-y' (`mail-yank-original') uses
  464.      `indent-rigidly' to indent the text copied from the message being
  465.      replied to.
  466.  
  467.  - Function: indent-code-rigidly START END COLUMNS &optional
  468.           NOCHANGE-REGEXP
  469.      This is like `indent-rigidly', except that it doesn't alter lines
  470.      that start within strings or comments.
  471.  
  472.      In addition, it doesn't alter a line if NOCHANGE-REGEXP matches at
  473.      the beginning of the line (if NOCHANGE-REGEXP is non-`nil').
  474.  
  475. 
  476. File: lispref.info,  Node: Relative Indent,  Next: Indent Tabs,  Prev: Region Indent,  Up: Indentation
  477.  
  478. Indentation Relative to Previous Lines
  479. --------------------------------------
  480.  
  481.    This section describes two commands that indent the current line
  482. based on the contents of previous lines.
  483.  
  484.  - Command: indent-relative &optional UNINDENTED-OK
  485.      This command inserts whitespace at point, extending to the same
  486.      column as the next "indent point" of the previous nonblank line.
  487.      An indent point is a non-whitespace character following
  488.      whitespace.  The next indent point is the first one at a column
  489.      greater than the current column of point.  For example, if point
  490.      is underneath and to the left of the first non-blank character of
  491.      a line of text, it moves to that column by inserting whitespace.
  492.  
  493.      If the previous nonblank line has no next indent point (i.e., none
  494.      at a great enough column position), `indent-relative' either does
  495.      nothing (if UNINDENTED-OK is non-`nil') or calls
  496.      `tab-to-tab-stop'.  Thus, if point is underneath and to the right
  497.      of the last column of a short line of text, this command ordinarily
  498.      moves point to the next tab stop by inserting whitespace.
  499.  
  500.      The return value of `indent-relative' is unpredictable.
  501.  
  502.      In the following example, point is at the beginning of the second
  503.      line:
  504.  
  505.                       This line is indented twelve spaces.
  506.           -!-The quick brown fox jumped.
  507.  
  508.      Evaluation of the expression `(indent-relative nil)' produces the
  509.      following:
  510.  
  511.                       This line is indented twelve spaces.
  512.                       -!-The quick brown fox jumped.
  513.  
  514.      In this example, point is between the `m' and `p' of `jumped':
  515.  
  516.                       This line is indented twelve spaces.
  517.           The quick brown fox jum-!-ped.
  518.  
  519.      Evaluation of the expression `(indent-relative nil)' produces the
  520.      following:
  521.  
  522.                       This line is indented twelve spaces.
  523.           The quick brown fox jum  -!-ped.
  524.  
  525.  - Command: indent-relative-maybe
  526.      This command indents the current line like the previous nonblank
  527.      line.  It calls `indent-relative' with `t' as the UNINDENTED-OK
  528.      argument.  The return value is unpredictable.
  529.  
  530.      If the previous nonblank line has no indent points beyond the
  531.      current column, this command does nothing.
  532.  
  533. 
  534. File: lispref.info,  Node: Indent Tabs,  Next: Motion by Indent,  Prev: Relative Indent,  Up: Indentation
  535.  
  536. Adjustable "Tab Stops"
  537. ----------------------
  538.  
  539.    This section explains the mechanism for user-specified "tab stops"
  540. and the mechanisms that use and set them.  The name "tab stops" is used
  541. because the feature is similar to that of the tab stops on a
  542. typewriter.  The feature works by inserting an appropriate number of
  543. spaces and tab characters to reach the next tab stop column; it does not
  544. affect the display of tab characters in the buffer (*note Usual
  545. Display::.).  Note that the <TAB> character as input uses this tab stop
  546. feature only in a few major modes, such as Text mode.
  547.  
  548.  - Command: tab-to-tab-stop
  549.      This command inserts spaces or tabs up to the next tab stop column
  550.      defined by `tab-stop-list'.  It searches the list for an element
  551.      greater than the current column number, and uses that element as
  552.      the column to indent to.  It does nothing if no such element is
  553.      found.
  554.  
  555.  - User Option: tab-stop-list
  556.      This variable is the list of tab stop columns used by
  557.      `tab-to-tab-stops'.  The elements should be integers in increasing
  558.      order.  The tab stop columns need not be evenly spaced.
  559.  
  560.      Use `M-x edit-tab-stops' to edit the location of tab stops
  561.      interactively.
  562.  
  563. 
  564. File: lispref.info,  Node: Motion by Indent,  Prev: Indent Tabs,  Up: Indentation
  565.  
  566. Indentation-Based Motion Commands
  567. ---------------------------------
  568.  
  569.    These commands, primarily for interactive use, act based on the
  570. indentation in the text.
  571.  
  572.  - Command: back-to-indentation
  573.      This command moves point to the first non-whitespace character in
  574.      the current line (which is the line in which point is located).
  575.      It returns `nil'.
  576.  
  577.  - Command: backward-to-indentation ARG
  578.      This command moves point backward ARG lines and then to the first
  579.      nonblank character on that line.  It returns `nil'.
  580.  
  581.  - Command: forward-to-indentation ARG
  582.      This command moves point forward ARG lines and then to the first
  583.      nonblank character on that line.  It returns `nil'.
  584.  
  585. 
  586. File: lispref.info,  Node: Case Changes,  Next: Text Properties,  Prev: Indentation,  Up: Text
  587.  
  588. Case Changes
  589. ============
  590.  
  591.    The case change commands described here work on text in the current
  592. buffer.  *Note Character Case::, for case conversion commands that work
  593. on strings and characters.  *Note Case Tables::, for how to customize
  594. which characters are upper or lower case and how to convert them.
  595.  
  596.  - Command: capitalize-region START END
  597.      This function capitalizes all words in the region defined by START
  598.      and END.  To capitalize means to convert each word's first
  599.      character to upper case and convert the rest of each word to lower
  600.      case.  The function returns `nil'.
  601.  
  602.      If one end of the region is in the middle of a word, the part of
  603.      the word within the region is treated as an entire word.
  604.  
  605.      When `capitalize-region' is called interactively, START and END
  606.      are point and the mark, with the smallest first.
  607.  
  608.           ---------- Buffer: foo ----------
  609.           This is the contents of the 5th foo.
  610.           ---------- Buffer: foo ----------
  611.           
  612.           (capitalize-region 1 44)
  613.           => nil
  614.           
  615.           ---------- Buffer: foo ----------
  616.           This Is The Contents Of The 5th Foo.
  617.           ---------- Buffer: foo ----------
  618.  
  619.  - Command: downcase-region START END
  620.      This function converts all of the letters in the region defined by
  621.      START and END to lower case.  The function returns `nil'.
  622.  
  623.      When `downcase-region' is called interactively, START and END are
  624.      point and the mark, with the smallest first.
  625.  
  626.  - Command: upcase-region START END
  627.      This function converts all of the letters in the region defined by
  628.      START and END to upper case.  The function returns `nil'.
  629.  
  630.      When `upcase-region' is called interactively, START and END are
  631.      point and the mark, with the smallest first.
  632.  
  633.  - Command: capitalize-word COUNT
  634.      This function capitalizes COUNT words after point, moving point
  635.      over as it does.  To capitalize means to convert each word's first
  636.      character to upper case and convert the rest of each word to lower
  637.      case.  If COUNT is negative, the function capitalizes the -COUNT
  638.      previous words but does not move point.  The value is `nil'.
  639.  
  640.      If point is in the middle of a word, the part of the word before
  641.      point is ignored when moving forward.  The rest is treated as an
  642.      entire word.
  643.  
  644.      When `capitalize-word' is called interactively, COUNT is set to
  645.      the numeric prefix argument.
  646.  
  647.  - Command: downcase-word COUNT
  648.      This function converts the COUNT words after point to all lower
  649.      case, moving point over as it does.  If COUNT is negative, it
  650.      converts the -COUNT previous words but does not move point.  The
  651.      value is `nil'.
  652.  
  653.      When `downcase-word' is called interactively, COUNT is set to the
  654.      numeric prefix argument.
  655.  
  656.  - Command: upcase-word COUNT
  657.      This function converts the COUNT words after point to all upper
  658.      case, moving point over as it does.  If COUNT is negative, it
  659.      converts the -COUNT previous words but does not move point.  The
  660.      value is `nil'.
  661.  
  662.      When `upcase-word' is called interactively, COUNT is set to the
  663.      numeric prefix argument.
  664.  
  665. 
  666. File: lispref.info,  Node: Text Properties,  Next: Substitution,  Prev: Case Changes,  Up: Text
  667.  
  668. Text Properties
  669. ===============
  670.  
  671.    Text properties are an alternative interface to extents (*note
  672. Extents::.), and are built on top of them.  They are useful when you
  673. want to view textual properties as being attached to the characters
  674. themselves rather than to intervals of characters.  The text property
  675. interface is compatible with FSF Emacs.
  676.  
  677.    Each character position in a buffer or a string can have a "text
  678. property list", much like the property list of a symbol (*note Property
  679. Lists::.).  The properties belong to a particular character at a
  680. particular place, such as, the letter `T' at the beginning of this
  681. sentence or the first `o' in `foo'--if the same character occurs in two
  682. different places, the two occurrences generally have different
  683. properties.
  684.  
  685.    Each property has a name and a value.  Both of these can be any Lisp
  686. object, but the name is normally a symbol.  The usual way to access the
  687. property list is to specify a name and ask what value corresponds to it.
  688.  
  689.    Note that FSF Emacs also looks at the `category' property to find
  690. defaults for text properties.  We consider this too bogus to implement.
  691.  
  692.    Copying text between strings and buffers preserves the properties
  693. along with the characters; this includes such diverse functions as
  694. `substring', `insert', and `buffer-substring'.
  695.  
  696. * Menu:
  697.  
  698. * Examining Properties::    Looking at the properties of one character.
  699. * Changing Properties::        Setting the properties of a range of text.
  700. * Property Search::        Searching for where a property changes value.
  701. * Special Properties::        Particular properties with special meanings.
  702. * Saving Properties::           Saving text properties in files, and reading
  703.                                   them back.
  704.  
  705. 
  706. File: lispref.info,  Node: Examining Properties,  Next: Changing Properties,  Up: Text Properties
  707.  
  708. Examining Text Properties
  709. -------------------------
  710.  
  711.    The simplest way to examine text properties is to ask for the value
  712. of a particular property of a particular character.  For that, use
  713. `get-text-property'.  Use `text-properties-at' to get the entire
  714. property list of a character.  *Note Property Search::, for functions
  715. to examine the properties of a number of characters at once.
  716.  
  717.    These functions handle both strings and buffers.  (Keep in mind that
  718. positions in a string start from 0, whereas positions in a buffer start
  719. from 1.)
  720.  
  721.  - Function: get-text-property POS PROP &optional OBJECT
  722.      This function returns the value of the PROP property of the
  723.      character after position POS in OBJECT (a buffer or string).  The
  724.      argument OBJECT is optional and defaults to the current buffer.
  725.  
  726.  - Function: get-char-property POS PROP &optional OBJECT
  727.      This function is like `get-text-property', except that it checks
  728.      all extents, not just text-property extents.
  729.  
  730.  
  731.  - Function: text-properties-at POSITION &optional OBJECT
  732.      This function returns the entire property list of the character at
  733.      POSITION in the string or buffer OBJECT.  If OBJECT is `nil', it
  734.      defaults to the current buffer.
  735.  
  736.  - Variable: default-text-properties
  737.      This variable holds a property list giving default values for text
  738.      properties.  Whenever a character does not specify a value for a
  739.      property, the value stored in this list is used instead.  Here is
  740.      an example:
  741.  
  742.           (setq default-text-properties '(foo 69))
  743.           ;; Make sure character 1 has no properties of its own.
  744.           (set-text-properties 1 2 nil)
  745.           ;; What we get, when we ask, is the default value.
  746.           (get-text-property 1 'foo)
  747.                => 69
  748.  
  749. 
  750. File: lispref.info,  Node: Changing Properties,  Next: Property Search,  Prev: Examining Properties,  Up: Text Properties
  751.  
  752. Changing Text Properties
  753. ------------------------
  754.  
  755.    The primitives for changing properties apply to a specified range of
  756. text.  The function `set-text-properties' (see end of section) sets the
  757. entire property list of the text in that range; more often, it is
  758. useful to add, change, or delete just certain properties specified by
  759. name.
  760.  
  761.    Since text properties are considered part of the buffer's contents,
  762. and can affect how the buffer looks on the screen, any change in the
  763. text properties is considered a buffer modification.  Buffer text
  764. property changes are undoable (*note Undo::.).
  765.  
  766.  - Function: put-text-property START END PROP VALUE &optional OBJECT
  767.      This function sets the PROP property to VALUE for the text between
  768.      START and END in the string or buffer OBJECT.  If OBJECT is `nil',
  769.      it defaults to the current buffer.
  770.  
  771.  - Function: add-text-properties START END PROPS &optional OBJECT
  772.      This function modifies the text properties for the text between
  773.      START and END in the string or buffer OBJECT.  If OBJECT is `nil',
  774.      it defaults to the current buffer.
  775.  
  776.      The argument PROPS specifies which properties to change.  It
  777.      should have the form of a property list (*note Property Lists::.):
  778.      a list whose elements include the property names followed
  779.      alternately by the corresponding values.
  780.  
  781.      The return value is `t' if the function actually changed some
  782.      property's value; `nil' otherwise (if PROPS is `nil' or its values
  783.      agree with those in the text).
  784.  
  785.      For example, here is how to set the `comment' and `face'
  786.      properties of a range of text:
  787.  
  788.           (add-text-properties START END
  789.                                '(comment t face highlight))
  790.  
  791.  - Function: remove-text-properties START END PROPS &optional OBJECT
  792.      This function deletes specified text properties from the text
  793.      between START and END in the string or buffer OBJECT.  If OBJECT
  794.      is `nil', it defaults to the current buffer.
  795.  
  796.      The argument PROPS specifies which properties to delete.  It
  797.      should have the form of a property list (*note Property Lists::.):
  798.      a list whose elements are property names alternating with
  799.      corresponding values.  But only the names matter--the values that
  800.      accompany them are ignored.  For example, here's how to remove the
  801.      `face' property.
  802.  
  803.           (remove-text-properties START END '(face nil))
  804.  
  805.      The return value is `t' if the function actually changed some
  806.      property's value; `nil' otherwise (if PROPS is `nil' or if no
  807.      character in the specified text had any of those properties).
  808.  
  809.  - Function: set-text-properties START END PROPS &optional OBJECT
  810.      This function completely replaces the text property list for the
  811.      text between START and END in the string or buffer OBJECT.  If
  812.      OBJECT is `nil', it defaults to the current buffer.
  813.  
  814.      The argument PROPS is the new property list.  It should be a list
  815.      whose elements are property names alternating with corresponding
  816.      values.
  817.  
  818.      After `set-text-properties' returns, all the characters in the
  819.      specified range have identical properties.
  820.  
  821.      If PROPS is `nil', the effect is to get rid of all properties from
  822.      the specified range of text.  Here's an example:
  823.  
  824.           (set-text-properties START END nil)
  825.  
  826.    See also the function `buffer-substring-without-properties' (*note
  827. Buffer Contents::.) which copies text from the buffer but does not copy
  828. its properties.
  829.  
  830. 
  831. File: lispref.info,  Node: Property Search,  Next: Special Properties,  Prev: Changing Properties,  Up: Text Properties
  832.  
  833. Property Search Functions
  834. -------------------------
  835.  
  836.    In typical use of text properties, most of the time several or many
  837. consecutive characters have the same value for a property.  Rather than
  838. writing your programs to examine characters one by one, it is much
  839. faster to process chunks of text that have the same property value.
  840.  
  841.    Here are functions you can use to do this.  They use `eq' for
  842. comparing property values.  In all cases, OBJECT defaults to the
  843. current buffer.
  844.  
  845.    For high performance, it's very important to use the LIMIT argument
  846. to these functions, especially the ones that search for a single
  847. property--otherwise, they may spend a long time scanning to the end of
  848. the buffer, if the property you are interested in does not change.
  849.  
  850.    Remember that a position is always between two characters; the
  851. position returned by these functions is between two characters with
  852. different properties.
  853.  
  854.  - Function: next-property-change POS &optional OBJECT LIMIT
  855.      The function scans the text forward from position POS in the
  856.      string or buffer OBJECT till it finds a change in some text
  857.      property, then returns the position of the change.  In other
  858.      words, it returns the position of the first character beyond POS
  859.      whose properties are not identical to those of the character just
  860.      after POS.
  861.  
  862.      If LIMIT is non-`nil', then the scan ends at position LIMIT.  If
  863.      there is no property change before that point,
  864.      `next-property-change' returns LIMIT.
  865.  
  866.      The value is `nil' if the properties remain unchanged all the way
  867.      to the end of OBJECT and LIMIT is `nil'.  If the value is
  868.      non-`nil', it is a position greater than or equal to POS.  The
  869.      value equals POS only when LIMIT equals POS.
  870.  
  871.      Here is an example of how to scan the buffer by chunks of text
  872.      within which all properties are constant:
  873.  
  874.           (while (not (eobp))
  875.             (let ((plist (text-properties-at (point)))
  876.                   (next-change
  877.                    (or (next-property-change (point) (current-buffer))
  878.                        (point-max))))
  879.               Process text from point to NEXT-CHANGE...
  880.               (goto-char next-change)))
  881.  
  882.  - Function: next-single-property-change POS PROP &optional OBJECT LIMIT
  883.      The function scans the text forward from position POS in the
  884.      string or buffer OBJECT till it finds a change in the PROP
  885.      property, then returns the position of the change.  In other
  886.      words, it returns the position of the first character beyond POS
  887.      whose PROP property differs from that of the character just after
  888.      POS.
  889.  
  890.      If LIMIT is non-`nil', then the scan ends at position LIMIT.  If
  891.      there is no property change before that point,
  892.      `next-single-property-change' returns LIMIT.
  893.  
  894.      The value is `nil' if the property remains unchanged all the way to
  895.      the end of OBJECT and LIMIT is `nil'.  If the value is non-`nil',
  896.      it is a position greater than or equal to POS; it equals POS only
  897.      if LIMIT equals POS.
  898.  
  899.  - Function: previous-property-change POS &optional OBJECT LIMIT
  900.      This is like `next-property-change', but scans back from POS
  901.      instead of forward.  If the value is non-`nil', it is a position
  902.      less than or equal to POS; it equals POS only if LIMIT equals POS.
  903.  
  904.  - Function: previous-single-property-change POS PROP &optional OBJECT
  905.           LIMIT
  906.      This is like `next-single-property-change', but scans back from
  907.      POS instead of forward.  If the value is non-`nil', it is a
  908.      position less than or equal to POS; it equals POS only if LIMIT
  909.      equals POS.
  910.  
  911.  - Function: text-property-any START END PROP VALUE &optional OBJECT
  912.      This function returns non-`nil' if at least one character between
  913.      START and END has a property PROP whose value is VALUE.  More
  914.      precisely, it returns the position of the first such character.
  915.      Otherwise, it returns `nil'.
  916.  
  917.      The optional fifth argument, OBJECT, specifies the string or
  918.      buffer to scan.  Positions are relative to OBJECT.  The default
  919.      for OBJECT is the current buffer.
  920.  
  921.  - Function: text-property-not-all START END PROP VALUE &optional OBJECT
  922.      This function returns non-`nil' if at least one character between
  923.      START and END has a property PROP whose value differs from VALUE.
  924.      More precisely, it returns the position of the first such
  925.      character.  Otherwise, it returns `nil'.
  926.  
  927.      The optional fifth argument, OBJECT, specifies the string or
  928.      buffer to scan.  Positions are relative to OBJECT.  The default
  929.      for OBJECT is the current buffer.
  930.  
  931. 
  932. File: lispref.info,  Node: Special Properties,  Next: Saving Properties,  Prev: Property Search,  Up: Text Properties
  933.  
  934. Properties with Special Meanings
  935. --------------------------------
  936.  
  937.    The predefined properties are the same as those for extents.  *Note
  938. Extent Properties::.
  939.  
  940. 
  941. File: lispref.info,  Node: Saving Properties,  Prev: Special Properties,  Up: Text Properties
  942.  
  943. Saving Text Properties in Files
  944. -------------------------------
  945.  
  946.    You can save text properties in files, and restore text properties
  947. when inserting the files, using these two hooks:
  948.  
  949.  - Variable: write-region-annotate-functions
  950.      This variable's value is a list of functions for `write-region' to
  951.      run to encode text properties in some fashion as annotations to
  952.      the text being written in the file.  *Note Writing to Files::.
  953.  
  954.      Each function in the list is called with two arguments: the start
  955.      and end of the region to be written.  These functions should not
  956.      alter the contents of the buffer.  Instead, they should return
  957.      lists indicating annotations to write in the file in addition to
  958.      the text in the buffer.
  959.  
  960.      Each function should return a list of elements of the form
  961.      `(POSITION . STRING)', where POSITION is an integer specifying the
  962.      relative position in the text to be written, and STRING is the
  963.      annotation to add there.
  964.  
  965.      Each list returned by one of these functions must be already
  966.      sorted in increasing order by POSITION.  If there is more than one
  967.      function, `write-region' merges the lists destructively into one
  968.      sorted list.
  969.  
  970.      When `write-region' actually writes the text from the buffer to the
  971.      file, it intermixes the specified annotations at the corresponding
  972.      positions.  All this takes place without modifying the buffer.
  973.  
  974.  - Variable: after-insert-file-functions
  975.      This variable holds a list of functions for `insert-file-contents'
  976.      to call after inserting a file's contents.  These functions should
  977.      scan the inserted text for annotations, and convert them to the
  978.      text properties they stand for.
  979.  
  980.      Each function receives one argument, the length of the inserted
  981.      text; point indicates the start of that text.  The function should
  982.      scan that text for annotations, delete them, and create the text
  983.      properties that the annotations specify.  The function should
  984.      return the updated length of the inserted text, as it stands after
  985.      those changes.  The value returned by one function becomes the
  986.      argument to the next function.
  987.  
  988.      These functions should always return with point at the beginning of
  989.      the inserted text.
  990.  
  991.      The intended use of `after-insert-file-functions' is for converting
  992.      some sort of textual annotations into actual text properties.  But
  993.      other uses may be possible.
  994.  
  995.    We invite users to write Lisp programs to store and retrieve text
  996. properties in files, using these hooks, and thus to experiment with
  997. various data formats and find good ones.  Eventually we hope users will
  998. produce good, general extensions we can install in Emacs.
  999.  
  1000.    We suggest not trying to handle arbitrary Lisp objects as property
  1001. names or property values--because a program that general is probably
  1002. difficult to write, and slow.  Instead, choose a set of possible data
  1003. types that are reasonably flexible, and not too hard to encode.
  1004.  
  1005.    *Note Format Conversion::, for a related feature.
  1006.  
  1007. 
  1008. File: lispref.info,  Node: Substitution,  Next: Registers,  Prev: Text Properties,  Up: Text
  1009.  
  1010. Substituting for a Character Code
  1011. =================================
  1012.  
  1013.    The following functions replace characters within a specified region
  1014. based on their character codes.
  1015.  
  1016.  - Function: subst-char-in-region START END OLD-CHAR NEW-CHAR &optional
  1017.           NOUNDO
  1018.      This function replaces all occurrences of the character OLD-CHAR
  1019.      with the character NEW-CHAR in the region of the current buffer
  1020.      defined by START and END.
  1021.  
  1022.      If NOUNDO is non-`nil', then `subst-char-in-region' does not
  1023.      record the change for undo and does not mark the buffer as
  1024.      modified.  This feature is used for controlling selective display
  1025.      (*note Selective Display::.).
  1026.  
  1027.      `subst-char-in-region' does not move point and returns `nil'.
  1028.  
  1029.           ---------- Buffer: foo ----------
  1030.           This is the contents of the buffer before.
  1031.           ---------- Buffer: foo ----------
  1032.           
  1033.           (subst-char-in-region 1 20 ?i ?X)
  1034.                => nil
  1035.           
  1036.           ---------- Buffer: foo ----------
  1037.           ThXs Xs the contents of the buffer before.
  1038.           ---------- Buffer: foo ----------
  1039.  
  1040.  - Function: translate-region START END TABLE
  1041.      This function applies a translation table to the characters in the
  1042.      buffer between positions START and END.
  1043.  
  1044.      The translation table TABLE is a string; `(aref TABLE OCHAR)'
  1045.      gives the translated character corresponding to OCHAR.  If the
  1046.      length of TABLE is less than 256, any characters with codes larger
  1047.      than the length of TABLE are not altered by the translation.
  1048.  
  1049.      The return value of `translate-region' is the number of characters
  1050.      that were actually changed by the translation.  This does not
  1051.      count characters that were mapped into themselves in the
  1052.      translation table.
  1053.  
  1054. 
  1055. File: lispref.info,  Node: Registers,  Next: Transposition,  Prev: Substitution,  Up: Text
  1056.  
  1057. Registers
  1058. =========
  1059.  
  1060.    A register is a sort of variable used in XEmacs editing that can
  1061. hold a marker, a string, a rectangle, a window configuration (of one
  1062. frame), or a frame configuration (of all frames).  Each register is
  1063. named by a single character.  All characters, including control and
  1064. meta characters (but with the exception of `C-g'), can be used to name
  1065. registers.  Thus, there are 255 possible registers.  A register is
  1066. designated in Emacs Lisp by a character that is its name.
  1067.  
  1068.    The functions in this section return unpredictable values unless
  1069. otherwise stated.
  1070.  
  1071.  - Variable: register-alist
  1072.      This variable is an alist of elements of the form `(NAME .
  1073.      CONTENTS)'.  Normally, there is one element for each XEmacs
  1074.      register that has been used.
  1075.  
  1076.      The object NAME is a character (an integer) identifying the
  1077.      register.  The object CONTENTS is a string, marker, or list
  1078.      representing the register contents.  A string represents text
  1079.      stored in the register.  A marker represents a position.  A list
  1080.      represents a rectangle; its elements are strings, one per line of
  1081.      the rectangle.
  1082.  
  1083.  - Function: get-register REG
  1084.      This function returns the contents of the register REG, or `nil'
  1085.      if it has no contents.
  1086.  
  1087.  - Function: set-register REG VALUE
  1088.      This function sets the contents of register REG to VALUE.  A
  1089.      register can be set to any value, but the other register functions
  1090.      expect only certain data types.  The return value is VALUE.
  1091.  
  1092.  - Command: view-register REG
  1093.      This command displays what is contained in register REG.
  1094.  
  1095.  - Command: insert-register REG &optional BEFOREP
  1096.      This command inserts contents of register REG into the current
  1097.      buffer.
  1098.  
  1099.      Normally, this command puts point before the inserted text, and the
  1100.      mark after it.  However, if the optional second argument BEFOREP
  1101.      is non-`nil', it puts the mark before and point after.  You can
  1102.      pass a non-`nil' second argument BEFOREP to this function
  1103.      interactively by supplying any prefix argument.
  1104.  
  1105.      If the register contains a rectangle, then the rectangle is
  1106.      inserted with its upper left corner at point.  This means that
  1107.      text is inserted in the current line and underneath it on
  1108.      successive lines.
  1109.  
  1110.      If the register contains something other than saved text (a
  1111.      string) or a rectangle (a list), currently useless things happen.
  1112.      This may be changed in the future.
  1113.  
  1114. 
  1115. File: lispref.info,  Node: Transposition,  Next: Change Hooks,  Prev: Registers,  Up: Text
  1116.  
  1117. Transposition of Text
  1118. =====================
  1119.  
  1120.    This subroutine is used by the transposition commands.
  1121.  
  1122.  - Function: transpose-regions START1 END1 START2 END2 &optional
  1123.           LEAVE-MARKERS
  1124.      This function exchanges two nonoverlapping portions of the buffer.
  1125.      Arguments START1 and END1 specify the bounds of one portion and
  1126.      arguments START2 and END2 specify the bounds of the other portion.
  1127.  
  1128.      Normally, `transpose-regions' relocates markers with the transposed
  1129.      text; a marker previously positioned within one of the two
  1130.      transposed portions moves along with that portion, thus remaining
  1131.      between the same two characters in their new position.  However,
  1132.      if LEAVE-MARKERS is non-`nil', `transpose-regions' does not do
  1133.      this--it leaves all markers unrelocated.
  1134.  
  1135. 
  1136. File: lispref.info,  Node: Change Hooks,  Prev: Transposition,  Up: Text
  1137.  
  1138. Change Hooks
  1139. ============
  1140.  
  1141.    These hook variables let you arrange to take notice of all changes in
  1142. all buffers (or in a particular buffer, if you make them buffer-local).
  1143.  
  1144.    The functions you use in these hooks should save and restore the
  1145. match data if they do anything that uses regular expressions;
  1146. otherwise, they will interfere in bizarre ways with the editing
  1147. operations that call them.
  1148.  
  1149.    Buffer changes made while executing the following hooks don't
  1150. themselves cause any change hooks to be invoked.
  1151.  
  1152.  - Variable: before-change-functions
  1153.      This variable holds a list of a functions to call before any buffer
  1154.      modification.  Each function gets two arguments, the beginning and
  1155.      end of the region that is about to change, represented as
  1156.      integers.  The buffer that is about to change is always the
  1157.      current buffer.
  1158.  
  1159.  - Variable: after-change-functions
  1160.      This variable holds a list of a functions to call after any buffer
  1161.      modification.  Each function receives three arguments: the
  1162.      beginning and end of the region just changed, and the length of
  1163.      the text that existed before the change.  (To get the current
  1164.      length, subtract the region beginning from the region end.)  All
  1165.      three arguments are integers.  The buffer that's about to change
  1166.      is always the current buffer.
  1167.  
  1168.  - Variable: before-change-function
  1169.      This obsolete variable holds one function to call before any buffer
  1170.      modification (or `nil' for no function).  It is called just like
  1171.      the functions in `before-change-functions'.
  1172.  
  1173.  - Variable: after-change-function
  1174.      This obsolete variable holds one function to call after any buffer
  1175.      modification (or `nil' for no function).  It is called just like
  1176.      the functions in `after-change-functions'.
  1177.  
  1178.  - Variable: first-change-hook
  1179.      This variable is a normal hook that is run whenever a buffer is
  1180.      changed that was previously in the unmodified state.
  1181.  
  1182.